<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        if (Schema::hasTable('tags')) {
            return;
        }
        Schema::create('tags', function (Blueprint $table) {
            $table->id(); 
            $table->string('name', 50)->comment('名称');
            $table->unsignedInteger('pid')->default(0)->comment('上级主键');
            $table->string('full_name', 200)->nullable()->comment('父级名称');
            $table->unsignedSmallInteger('sort')->default(50)->comment('数据排序（升序）');
            $table->unsignedTinyInteger('status')->default(1)->comment('可用状态 0:否 1:是');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        if (Schema::hasTable('tags')) {
            return;
        }
        Schema::dropIfExists('tags');
    }
};
